package ${%^serviceImplPath^%};

import ${%^mapperPath^%}.${%^type^%}Mapper;
import ${%^modelPath^%}.${%^type^%};
import ${%^servicePath^%}.${%^type^%}Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
${%^imports^%}

@Service
public class ${%^type^%}ServiceImpl implements ${%^type^%}Service {

    @Autowired
    private ${%^type^%}Mapper mapper;

    @Override
    public Map<String, Object> list(Map<String, Object> map) {
        Map<String, Object> res = new HashMap<>();
        List<User> list = mapper.list(map);
        Long count = mapper.count(map);
        res.put("data", list);
        res.put("count", count);
        return res;
    }

    @Override
    public Integer deletes(List<${%^tablePrimaryKeyType^%}> list) {
        return mapper.deletes(list);
    }
    @Override
    public Integer update(${%^type^%} data) {
        return mapper.update(data);
    }
    @Override
    public Integer insert(List<${%^type^%}> datas) {
        return mapper.insert(datas);
    }
    @Override
    public Integer insert(${%^type^%} data) {
        List<${%^type^%}> list = new ArrayList<>();
        list.add(data);
        return mapper.insert(list);
    }

    @Override
    public List<${%^type^%}> query(${%^type^%} data) {
        return mapper.query(data);
    }
}
